var pageSize = 20;
//查找单位
function find(){
	genPageSize();
	var x = document.getElementById("thesearch").value;
	var url = "frontend/thefind.asp?timestamp="+ new Date().getTime();
	createXMLHttpRequest();
	xmlHttp.onreadystatechange = handlefindStateChange;
    xmlHttp.open("Post",url,true);
	xmlHttp.setRequestHeader("Content-type","application/x-www-form-urlencoded;");
    xmlHttp.send("x="+x+"&y="+pageSize);
}
//动态生成分页个数
function genPageSize(){
	var theh = document.body.clientHeight-230;
	pageSize = parseInt(theh/23.1);
}
function handlefindStateChange() {
	if(xmlHttp.readyState == 4) {
		if(xmlHttp.status == 200) {
			var x = document.getElementById("thesearch").value;
			var ajaxRequestObj = xmlHttp.responseText;
			addtag("find","查找","search.gif");
			switchtag("find");
			if (ajaxRequestObj==""){
				if (x!=""){
					document.all.find.innerHTML = "<div style='padding:15px 20px;font:14px'>关键字&quot;<font color=red>"+document.getElementById("thesearch").value+"</font>&quot;没有搜索到结果</div>";
					document.all.topoperation.innerHTML = "搜索";
				}else{
					document.all.find.innerHTML = "<div style='padding:15px 20px;font:14px'>请输入搜索关键字</div>";
				}
			}else{
				document.all.find.innerHTML = ajaxRequestObj;
				document.all.topoperation.innerHTML = "搜索";
			}
        }
    }
}
//聚焦目录树
function focusDep(rootid){
	var theli = document.getElementById("dep"+rootid);
	var thea = theli.getElementsByTagName("a");
	var tmpid;
	if (rootid+20<126){
		tmpid = rootid+20;
	}else{
		tmpid = 200;
	}
	if (typeof(theli.getElementsByTagName("ul")[0])=="object"){
		theli.getElementsByTagName("ul")[0].removeNode(true);
	}
	thea[0].className="close";
	document.getElementById("a"+tmpid).focus();
	switchclass(rootid,thea[0],0);
	innerloadingtext(thea[1]);
}
//翻页
function GotoPage(theForm,nPageNo){
	var x = document.getElementById("thesearch").value;
	var url = "frontend/thefind.asp?timestamp="+ new Date().getTime();
	createXMLHttpRequest();
	xmlHttp.onreadystatechange = handlefindStateChange;
    xmlHttp.open("Post",url,true);
	xmlHttp.setRequestHeader("Content-type","application/x-www-form-urlencoded;");
    xmlHttp.send("x="+x+"&Page="+nPageNo+"&y="+pageSize);
}